{"ast":null,"code":"import { useEffect, useRef } from 'react';\nexport default function useMutationObserver() {\n  var instance = useRef();\n  var destroyObserver = function destroyObserver() {\n    if (instance.current) {\n      instance.current.takeRecords();\n      instance.current.disconnect();\n      instance.current = undefined;\n    }\n  };\n  var createObserver = function createObserver(target, callback) {\n    if (MutationObserver) {\n      destroyObserver();\n      instance.current = new MutationObserver(callback);\n      instance.current.observe(target, {\n        childList: true,\n        subtree: true,\n        attributeFilter: ['style', 'class']\n      });\n    }\n  };\n  useEffect(function () {\n    return destroyObserver;\n  }, []);\n  var reRendering = function reRendering(mutation, watermarkElement) {\n    var flag = false;\n    // Whether to delete the watermark node\n    if (mutation.removedNodes.length) {\n      flag = Array.from(mutation.removedNodes).some(function (node) {\n        return node === watermarkElement;\n      });\n    }\n    // Whether the watermark dom property value has been modified\n    if (mutation.type === 'attributes' && mutation.target === watermarkElement) {\n      flag = true;\n    }\n    return flag;\n  };\n  return {\n    createObserver: createObserver,\n    destroyObserver: destroyObserver,\n    reRendering: reRendering\n  };\n}","map":{"version":3,"names":["useEffect","useRef","useMutationObserver","instance","destroyObserver","current","takeRecords","disconnect","undefined","createObserver","target","callback","MutationObserver","observe","childList","subtree","attributeFilter","reRendering","mutation","watermarkElement","flag","removedNodes","length","Array","from","some","node","type"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/antd/es/watermark/useMutationObserver.js"],"sourcesContent":["import { useEffect, useRef } from 'react';\nexport default function useMutationObserver() {\n  const instance = useRef();\n  const destroyObserver = () => {\n    if (instance.current) {\n      instance.current.takeRecords();\n      instance.current.disconnect();\n      instance.current = undefined;\n    }\n  };\n  const createObserver = (target, callback) => {\n    if (MutationObserver) {\n      destroyObserver();\n      instance.current = new MutationObserver(callback);\n      instance.current.observe(target, {\n        childList: true,\n        subtree: true,\n        attributeFilter: ['style', 'class']\n      });\n    }\n  };\n  useEffect(() => destroyObserver, []);\n  const reRendering = (mutation, watermarkElement) => {\n    let flag = false;\n    // Whether to delete the watermark node\n    if (mutation.removedNodes.length) {\n      flag = Array.from(mutation.removedNodes).some(node => node === watermarkElement);\n    }\n    // Whether the watermark dom property value has been modified\n    if (mutation.type === 'attributes' && mutation.target === watermarkElement) {\n      flag = true;\n    }\n    return flag;\n  };\n  return {\n    createObserver,\n    destroyObserver,\n    reRendering\n  };\n}"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,eAAe,SAASC,mBAAmB,GAAG;EAC5C,IAAMC,QAAQ,GAAGF,MAAM,EAAE;EACzB,IAAMG,eAAe,GAAG,SAAlBA,eAAe,GAAS;IAC5B,IAAID,QAAQ,CAACE,OAAO,EAAE;MACpBF,QAAQ,CAACE,OAAO,CAACC,WAAW,EAAE;MAC9BH,QAAQ,CAACE,OAAO,CAACE,UAAU,EAAE;MAC7BJ,QAAQ,CAACE,OAAO,GAAGG,SAAS;IAC9B;EACF,CAAC;EACD,IAAMC,cAAc,GAAG,SAAjBA,cAAc,CAAIC,MAAM,EAAEC,QAAQ,EAAK;IAC3C,IAAIC,gBAAgB,EAAE;MACpBR,eAAe,EAAE;MACjBD,QAAQ,CAACE,OAAO,GAAG,IAAIO,gBAAgB,CAACD,QAAQ,CAAC;MACjDR,QAAQ,CAACE,OAAO,CAACQ,OAAO,CAACH,MAAM,EAAE;QAC/BI,SAAS,EAAE,IAAI;QACfC,OAAO,EAAE,IAAI;QACbC,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO;MACpC,CAAC,CAAC;IACJ;EACF,CAAC;EACDhB,SAAS,CAAC;IAAA,OAAMI,eAAe;EAAA,GAAE,EAAE,CAAC;EACpC,IAAMa,WAAW,GAAG,SAAdA,WAAW,CAAIC,QAAQ,EAAEC,gBAAgB,EAAK;IAClD,IAAIC,IAAI,GAAG,KAAK;IAChB;IACA,IAAIF,QAAQ,CAACG,YAAY,CAACC,MAAM,EAAE;MAChCF,IAAI,GAAGG,KAAK,CAACC,IAAI,CAACN,QAAQ,CAACG,YAAY,CAAC,CA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